/*********************************************************
          File Name:pure_virtual.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 26 Sep 2015 04:56:33 PM CST
**********************************************************/

#include <iostream>
#include <string>

using namespace std;

class Base
{
        private:
                string s;
        public:
                Base(string x): s(x) {}

                virtual void print() = 0;       // pure virtual function
};

void Base::print()
{
        cout << s << endl;
}

class Derived: public Base
{
        private:
                string s;
        public:
                Derived(string x, string y): Base(x), s(y) {}

                virtual void print()
                {
                        cout << s << endl;
                }
};

int main()
{
        //Base x("base");         // not allowed
        
        Derived D("abstract class Base", "Derived");

        Base *pB = &D;

        pB->print();

        pB->Base::print();

        return 0;
}
